<?php

class CommentForm extends CFormModel
{
	public $author;
	public $email;
	public $content;
	public $verifyCode;

	/**
	 * Declares the validation rules.
	 */
	public function rules()
	{
		return array(
			// name, email, subject and body are required
			array('author, email, content', 'required'),
			array('content', 'length', 'min'=>50),
			// email has to be a valid email address
			array('email', 'email'),
			// verifyCode needs to be entered correctly
			array('verifyCode', 'captcha', 'allowEmpty'=>!CCaptcha::checkRequirements()),
		);
	}

	/**
	 * Declares customized attribute labels.
	 * If not declared here, an attribute would have a label that is
	 * the same as its name with the first letter in upper case.
	 */
	public function attributeLabels()
	{
		return array(
			'author'=>Yii::t('app','Your Name'),
			'content'=>Yii::t('app','Content'),
			'email'=>Yii::t('app','Email'),
			'verifyCode'=>Yii::t('app','Verification Code'),
		);
	}
}